<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
	</head>
	<body>
		<script>
			var info = {
				name: 'abc',
				age: 16,
				height: 1.88,
			}

			// for循环遍历
			console.log('for循环遍历')
			var keys = Object.keys(info)
			for (var i = 0; i < keys.length; i++) {
				console.log(keys[i], info[keys[i]])
			}

			// for in
			console.log('for in循环')
			for (const key in info) {
				console.log(key, info[key])
			}

			// for of(默认是不能遍历对象的, 除非对象实现了迭代器方法)
			for (const key of info) {
				console.log(key, info[key])
			}
		</script>
	</body>
</html>
